home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12811 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: noc.netcom.net!news
  2. From: Tarang Deshpande <tarang@willows.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Weird Results with this code :(
  5. Date: Tue, 02 Apr 1996 14:59:02 -0800
  6. Organization: NETCOM Network Operations
  7. Message-ID: <3161B136.D7B@willows.com>
  8. References: <4jqijm$jpk@uwm.edu>
  9. NNTP-Posting-Host: daffy.willows.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB2 (Win95; I)
  14.  
  15. Peter J Kleczka wrote:
  16. > The program is supposed to display
  17. > some digits leave them on the screen for a second or so
  18. > and then erase them.  The "bug" is that the program seems
  19. > to jump to the timer-loop BEFORE it prints out the digits.
  20. > Consequently the desired display/delay/erase sequence works
  21. > in the wrong order: delay/display/erase.
  22.  
  23.  
  24. It's probably because between the time you initialize now and until
  25. the loop a second has passed in both printing and waiting for the
  26. pause.  Instead get rid of the line that initializes now and move
  27. it into the initialization section of the loop.
  28.  
  29. for ( now = clock(); clock () - now < CLOCKS_PER_SEC; );
  30.  
  31. Tarang
  32.